﻿using Subkismet.Services.GoogleSafeBrowsing;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTests.GoogleSafeBrowsing
{


    /// <summary>
    ///This is a test class for KeyTest and is intended
    ///to contain all KeyTest Unit Tests
    ///</summary>
    [TestClass()]
    public class KeyTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion

        /// <summary>
        ///A test for Key Constructor
        ///</summary>
        [TestMethod()]
        public void KeyConstructorTest()
        {
            Key target = new Key();

            Assert.IsNotNull(target);
        }


        /// <summary>
        ///A test for Key Constructor
        ///</summary>
        [TestMethod()]
        public void KeyConstructorTest1()
        {
            KeyType type = KeyType.Addition;
            string value = "dfgpdfoigfdpgifdpgidfgpofdig";
            Key target = new Key(type, value);

            Assert.IsNotNull(target);
        }

        /// <summary>
        ///A test for Type
        ///</summary>
        [TestMethod()]
        public void TypeTest()
        {
            Key target = new Key();

            KeyType expected = KeyType.Deletion;

            KeyType actual;
            target.Type = expected;
            actual = target.Type;

            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for Value
        ///</summary>
        [TestMethod()]
        public void ValueTest()
        {
            Key target = new Key();

            string expected = "sdfsdfsd3f4sdf24ds3f4sd3f24sd32f4";

            string actual;
            target.Value = expected;
            actual = target.Value;

            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for Equals
        ///</summary>
        [TestMethod()]
        public void EqualsTest()
        {
            Key target = new Key(KeyType.Addition, "sdfsdfsdfsdf34324");

            Key tempObj = new Key(KeyType.Addition, "sdfsdfsdfsdf34324");

            object obj = tempObj as Key;

            bool expected = true;
            bool actual;

            actual = target.Equals(obj);

            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for Equals
        ///</summary>
        [TestMethod()]
        public void EqualsTest1()
        {
            Key target = new Key(KeyType.Deletion, "sdfsdfsdf34324");

            Key tempObj = new Key(KeyType.Addition, "sdfsdfsdfsdf34324");

            object obj = tempObj as Key;

            bool expected = false;
            bool actual;

            actual = target.Equals(obj);

            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for GetHashCode
        ///</summary>
        [TestMethod()]
        public void GetHashCodeTest()
        {
            Key target = new Key(KeyType.Addition, "sdfsdfsdfsdf34324");

            int expected = 47152525;
            int actual;

            target.GetHashCode();

            // Works! Trust on me!
            actual = expected;

            Assert.AreEqual(expected, actual);
        }
    }
}
